/**
 * 
 */
package uit.comstore.model.entity;

import java.io.Serializable;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @author XIII
 *
 */
@Entity
@Table(name="Inventories")
@AssociationOverrides({@AssociationOverride(name="month", joinColumns=@JoinColumn(name="Month")),
						@AssociationOverride(name="year", joinColumns=@JoinColumn(name="Year")),
						@AssociationOverride(name="product", joinColumns=@JoinColumn(name="ProductsId", referencedColumnName="ProductsId"))})
@SuppressWarnings("serial")
public class Inventory implements Serializable {

	private InventoryPK inventoryPK = new InventoryPK();
	private Integer firstQuantity;
	private Integer importQuantity;
	private Integer exportQuantity;
	private Integer lastQuantity;
	
	@EmbeddedId
	public InventoryPK getInventoryPK() {
		return inventoryPK;
	}
	public void setInventoryPK(InventoryPK inventoryPK) {
		this.inventoryPK = inventoryPK;
	}
	
	@Column(name="FirstQuantity")
	public Integer getFirstQuantity() {
		return firstQuantity;
	}
	public void setFirstQuantity(Integer firstQuantity) {
		this.firstQuantity = firstQuantity;
	}
	
	@Column(name="ImportQuantity")
	public Integer getImportQuantity() {
		return importQuantity;
	}
	public void setImportQuantity(Integer importQuantity) {
		this.importQuantity = importQuantity;
	}
	
	@Column(name="ExportQuantity")
	public Integer getExportQuantity() {
		return exportQuantity;
	}
	public void setExportQuantity(Integer exportQuantity) {
		this.exportQuantity = exportQuantity;
	}
	
	@Column(name="LastQuantity")
	public Integer getLastQuantity() {
		return lastQuantity;
	}
	public void setLastQuantity(Integer lastQuantity) {
		this.lastQuantity = lastQuantity;
	}
	
	@Transient
	public Integer getMonth() {
		return getInventoryPK().getMonth();
	}
	public void setMonth(Integer month) {
		getInventoryPK().setMonth(month);
	}
	
	@Transient
	public Integer getYear() {
		return getInventoryPK().getYear();
	}
	public void setYear(Integer year) {
		getInventoryPK().setYear(year);
	}
	
	@Transient
	public Product getProduct() {
		return getInventoryPK().getProduct();
	}
	public void setProduct(Product product) {
		getInventoryPK().setProduct(product);
	}
}
